package com.asm.DBloader;

import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

public class ASM_fDealerDS {
	private SQLiteDatabase dB;
	private ASM_DB dbHelper;
	Context context;

	
	public ASM_fDealerDS (Context context)
	{
		this.context = context;
		dbHelper = new ASM_DB(context);
	}
	
	public void open() throws SQLException
	{
		dB = dbHelper.getWritableDatabase();
	}
	public int Create(ASM_fDealer det) {
		
		int count =0;
		
		if(dB == null){
			open();
		}else if(!dB.isOpen()){
			open();
		}
		
		 
	
		ContentValues values = new ContentValues();
		values.put(ASM_DB.asmFdealer_DealCode, det.getAsmFdealer_DealCode());
		values.put(ASM_DB.asmFdealer_DealName, det.getAsmFdealer_DealName());
		
		count = (int) dB.insert(ASM_DB.ASM_FDEALER, null, values);

		dB.close();
		return count;
		
	}
}
